﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IDatabase.cs" company="Concept Architecture">
//   (c) 2010 Muhammad Umer Farooq
// </copyright>
// <summary>
//   Defines the <seealso cref="Hisaab.Data.Interfaces.IDatabase" /> interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Hisaab.Data.Interfaces
{
    using System.Data.Objects;
    using Entities;

    /// <summary>
    /// Defines the <seealso cref="Hisaab.Data.Interfaces.IDatabase"/> interface.
    /// </summary>
    public interface IDatabase
    {
        /// <summary>
        /// Gets the accounts.
        /// </summary>
        IObjectSet<Account> Accounts { get; }

        /// <summary>
        /// Gets the account types.
        /// </summary>
        IObjectSet<AccountType> AccountTypes { get; }

        /// <summary>
        /// Gets the tags.
        /// </summary>
        IObjectSet<Tag> Tags { get; }

        /// <summary>
        /// Gets the transactions.
        /// </summary>
        /// <value>The transactions.</value>
        IObjectSet<Transaction> Transactions { get; }

        /// <summary>
        /// Gets the vehicles.
        /// </summary>
        /// <value>The vehicles.</value>
        IObjectSet<Vehicle> Vehicles { get; }

        /// <summary>
        /// Gets the vehicle transactions.
        /// </summary>
        /// <value>The vehicle transactions.</value>
        IObjectSet<VehicleTransaction> VehicleTransactions { get; }

        /// <summary>
        /// Gets the users.
        /// </summary>
        IObjectSet<User> Users { get; }

        /// <summary>
        /// Gets the targets.
        /// </summary>
        /// <value>The targets.</value>
        IObjectSet<Target> Targets { get; }

        /// <summary>
        /// Gets the bills.
        /// </summary>
        /// <value>The bills.</value>
        IObjectSet<Bill> Bills { get; }

        /// <summary>
        /// Commits the data into database
        /// </summary>
        /// <returns>The number of dirty in the when SaveChanges was called</returns>
        int SaveChanges();

        /// <summary>
        /// Updates the System.Data.Objects.ObjectStateManager with store data for specific entities. The order in which entities are refreshed is non-deterministic.
        /// </summary>
        /// <param name="refreshMode">One of the System.Data.Objects.RefreshMode values that specifies which mode to use for refreshing the System.Data.Objects.ObjectStateManager.</param>
        /// <param name="entity">This argument must not be null, and contain System.Data.Objects.DataClasses.IEntity object. Object must be attached to this context.</param>
        void Refresh(RefreshMode refreshMode, object entity);

        /// <summary>
        /// Updates the System.Data.Objects.ObjectStateManager with store data for specific entities. The order in which entities are refreshed is non-deterministic.
        /// </summary>
        /// <param name="refreshMode">One of the System.Data.Objects.RefreshMode values that specifies which mode to use for refreshing the System.Data.Objects.ObjectStateManager.</param>
        /// <param name="collection">This argument must not be null, and contain System.Data.Objects.DataClasses.IEntity objects. All System.Data.Objects.DataClasses.IEntity objects must be attached to this context.</param>
        void Refresh(RefreshMode refreshMode, System.Collections.IEnumerable collection);
    }
}